/**
 * 
 */
package ru.rchervot.sanasar.client.place;

class HistoryTokenObject {
	private static final String DELIMITER = "/";
	
	private String moduleName = "";
	private String placeName = "";
	private String placeParameters = "";
	
	private HistoryTokenObject(String historyToken) {
		if (historyToken == null || historyToken.length() == 0) return;
		
		try {
			String[] tokens = historyToken.split(DELIMITER);
			
			if (tokens[0] != null) {
				moduleName = tokens[0];
			}
			
			if (tokens.length > 1 && tokens[1] != null) {
				placeName = tokens[1];
			}
			
			if (tokens.length > 2 && tokens[2] != null) {
				placeParameters = tokens[2];
			}
			
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
	
	public static HistoryTokenObject build(String historyToken) {
		return new HistoryTokenObject(historyToken);
	}
	
	public String getModuleName() {
		return moduleName;
	}

	public String getPlaceName() {
		return placeName;
	}

	public String getPlaceParameters() {
		return placeParameters;
	}
}